#ifndef GRAPH_H
#define GRAPH_H

#include <vector>
#include <map>
#include <list>
#include <iterator>

using namespace std;

/*
 * Macierz sąsiedztwa
 *
 */

class m_graph;
class m_graph_iter;

class m_graph {
	int** adj_matrix;
	int _V, _E;
		
public:
	typedef m_graph_iter adj_ref;
	typedef m_graph_iter adj_iterator;
	
	
	m_graph();
	
	void load();
	void load(const char* filename);
	
	int V();
	int E();

	adj_ref operator[](int n);

};

class m_graph_iter: public iterator<forward_iterator_tag, int> {
	int* beg_ptr, *ptr;
	int size;
		
public:

	m_graph_iter();
	m_graph_iter(int* beg_ptr, int* ptr, int size);
	
	std::pair<int,int> operator*();
	const m_graph_iter& operator++();
	bool operator!=(const m_graph_iter& other) const;
	
		
	m_graph_iter begin();
	m_graph_iter end();
		
};

/*
 * Lista sąsiędztwa
 *
 */

class v_graph {
	vector<map<int,int> > *adj_vector;
	int _V, _E;
	
public:
	typedef map<int,int> & adj_ref;
	typedef map<int,int>::iterator adj_iterator;

	int V();
	int E();
	
	v_graph();
	
	void load();
	void load(const char* filename);
	
	adj_ref operator[](int n);
	
};



/*
class graph {

    int V;
    int E;
	vector<map<int,int> > *adj_vector;
	int	**adj_matrix;

	list<map<int,int> > *adj_list;
	
public:
	graph();

	int getV();
	int	getE();
	void t_start();
	void t_stop();
	unsigned long long t_ms;

    void load_vector(const char* filename);
	void print_vector();

	void load_list(const char* filename);
	void print_list();

	void load_matrix(const char* filename);
	void print_matrix();

	int bellman_ford(int start, int meta);
	int bellman_ford_matrix(int start, int meta);
	int bellman_ford_list(int start, int meta);

    int dijkstra(int start, int meta);
	int dijkstra_matrix(int start, int meta);
	int dijkstra_list(int start, int meta);

	int mst_kruskal();
	int mst_kruskal_matrix();
	int mst_prim(int start);
	int mst_prim_matrix(int start);

    void queue_tests();
	void t_test();
};
*/
#endif
